#include <RobotI.h>

RobotI::RobotI
(string address):
  _address(address),
  _destroyed(false)
{
}

RobotI::~RobotI()
{
}

void
RobotI::move (const Robots::RobotPos& to, 
	      const Ice::Current&)
{
}

void
RobotI::stop (const Ice::Current&)
{
}

void
RobotI::turn (Robots::Direction dir, 
	      Ice::Int degrees, 
	      const Ice::Current&)
{
}

Ice::ByteSeq
RobotI::capture (Robots::Resolution res, 
		 const ::Ice::Current&)
{
}

void
RobotI::setLaser (bool on, 
		  const Ice::Current&)
{
}

void
RobotI::destroy
(const Ice::Current& curr)
{
  IceUtil::Mutex::Lock lock(_m);
  
  if (isZombie())
    throw Ice::ObjectNotExistException(__FILE__, __LINE__);
  _destroyed = true;

  // Remove the servant from the object adapter.
  curr.adapter->remove(curr.id);
}

bool
RobotI::isZombie()
{
  return _destroyed;
}
